#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;

int main()
{
	int T, N;
	int i, j, k, ii;
	char word[2][13];
	
	scanf("%d", &T);
	while(T--)
	{
		scanf("%d", &N);
		scanf("%s", word[0]);
		for(i = 1, k = 0; i < N; i++)
		{
			k ^= 1;
			scanf("%s", word[k]);
			for(j = 0; j < 12; j++)
			{
				for(ii = 0; ii < 12 && word[k^1][ii] != word[k][j]; ii++)
					;
				if(ii != 12) word[k^1][ii] = '#';
				else word[k][j] = '#';
			}
		}
		sort(word[k], word[k]+12);
		for(i = 0; i < 12; i++)
		{
			if(word[k][i] != '#')printf("%c", word[k][i]);
		}
		puts("");
	}
	return 0;
}

/*
5
2
BBBBBBBBBBBB
AAAAAABBBBBB
2
ABCDEFGHIJKL
ABCDEFGHIJKL
2
SAWBCVUXDTPN
ZQTLFJYRCGAK
2  
AAAAAABBBBCC  
BBBBBBBBBBBB
1
AAADDDEEECCC
*/
